#include <bits/stdc++.h>

using namespace std;
int N,L,R;
vector<unordered_set<int>> sons;

int ans;

int dfs(int cur){
    int t = 1;
    for(auto son: sons[cur]){
        t += dfs(son);
    }
    if(L <= t && t <= R) ans++;
    return t;
}

int main() {
    cin>>N>>L>>R;
    sons.resize(N+1);
    ans = 0;
    for(int i = 2; i <= N; ++i){
        int f;
        cin >> f;
        sons[f].insert(i);
    }
    dfs(1);
    cout << ans << endl;
    //system("pause");
    return 0;
}
